Bayesian Modeling and Computation in Python, Exercise 1M21

A probabilistic model

(def result
  (py/with [_ (pm/Model)]
           (let [;; I write about 6 functions every day.
                 functions (pm/Poisson "functions"
                                       :mu 6)
                 ;; The probability of a bug in a function is 1%.
                 p-bug 0.01
                 ;; One day, I had 3 bugs.
                 bugs (pm/Binomial "bugs"
                                   :n functions
                                   :p p-bug
                                   :observed 3)]
             ;; Draw some inference about the number
             ;; of functions I wrote that day.
             {:prior (pm/sample_prior_predictive)
              :inference-data (pm/sample :chains 1)})))

Assumed prior

(vis.python/pyplot
 #(-> result
      :prior
      (py.- prior)
      az/plot_density))

Inferred posterior

(vis.python/pyplot
 #(-> result
      :inference-data
      (py.- posterior)
      az/plot_density))

Visualization using 3dmol

Basic shapes

(shapes-view
 {:width 200 :height 200}
 [[:sphere {:center {:x 0
                     :y 0
                     :z 0}
            :radius 3 :color "green"}]
  [:cylinder {:start {:x 0 :y 10 :z 20}
              :end {:x 10 :y 0 :z 30}
              :radius 2.5 :color :teal :alpha 0.5}]])

An x-y-z dataset

(def points
  (-> (tensor/compute-tensor [3 100]
                             (fn [i j] (-> (rand)
                                           (* 10)
                                           (+ j)
                                           (* 3))))
      (tensor/slice 1)
      (->> (zipmap [:x :y :z]))
      tc/dataset))
points

Turning a dataset into cylinders

(defn dataset->cylinders [dataset options]
  (-> dataset
      (tc/rows :as-maps)
      (->> ((juxt identity rest))
           (apply mapv (fn [xyz0 xyz1]
                         [:cylinder (merge {:start xyz0
                                            :end xyz1}
                                           options)])))))
(-> points
    (dataset->cylinders {:color "purple"}))
[[:cylinder
  {:start
   {:x 24.315609779396702,
    :y 22.921142053628373,
    :z 10.823023963707818},
   :end
   {:x 19.60791925987513, :y 27.764629098204086, :z 16.36210393259362},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 19.60791925987513, :y 27.764629098204086, :z 16.36210393259362},
   :end
   {:x 9.041563767329992, :y 16.65735676369182, :z 6.572246584431917},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 9.041563767329992, :y 16.65735676369182, :z 6.572246584431917},
   :end
   {:x 35.285258052392784,
    :y 9.888350240420104,
    :z 21.796974053219007},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 35.285258052392784,
    :y 9.888350240420104,
    :z 21.796974053219007},
   :end
   {:x 37.9906222079036, :y 30.17392168726752, :z 24.757811823329508},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 37.9906222079036, :y 30.17392168726752, :z 24.757811823329508},
   :end
   {:x 36.462219023865856, :y 43.21646033380067, :z 36.95615627975671},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 36.462219023865856, :y 43.21646033380067, :z 36.95615627975671},
   :end
   {:x 22.544208044991404,
    :y 36.975475161761636,
    :z 46.03328244484584},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 22.544208044991404,
    :y 36.975475161761636,
    :z 46.03328244484584},
   :end
   {:x 40.72004299517559, :y 22.97680297569891, :z 34.92784295440248},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 40.72004299517559, :y 22.97680297569891, :z 34.92784295440248},
   :end
   {:x 50.965533218441934,
    :y 33.18368884164352,
    :z 24.423097485715857},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 50.965533218441934,
    :y 33.18368884164352,
    :z 24.423097485715857},
   :end
   {:x 30.68780935528099,
    :y 31.070888891621138,
    :z 27.111574373851038},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 30.68780935528099,
    :y 31.070888891621138,
    :z 27.111574373851038},
   :end
   {:x 53.320519860992015, :y 50.9751004623113, :z 46.82540611797454},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 53.320519860992015, :y 50.9751004623113, :z 46.82540611797454},
   :end
   {:x 33.76344941818133, :y 62.06764329103028, :z 60.33696135476009},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 33.76344941818133, :y 62.06764329103028, :z 60.33696135476009},
   :end
   {:x 64.60696776872904, :y 40.66706736457029, :z 46.716582362762495},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 64.60696776872904, :y 40.66706736457029, :z 46.716582362762495},
   :end
   {:x 59.68289262120436, :y 40.160829356937725, :z 58.16729490387967},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 59.68289262120436, :y 40.160829356937725, :z 58.16729490387967},
   :end
   {:x 44.510671162424444, :y 56.25347158557926, :z 67.50277246122988},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 44.510671162424444, :y 56.25347158557926, :z 67.50277246122988},
   :end
   {:x 50.351996140593016,
    :y 57.97089990210779,
    :z 51.805315782446456},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 50.351996140593016,
    :y 57.97089990210779,
    :z 51.805315782446456},
   :end
   {:x 61.775755654897786,
    :y 70.63736764010386,
    :z 58.331734864438516},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 61.775755654897786,
    :y 70.63736764010386,
    :z 58.331734864438516},
   :end
   {:x 55.09425318302945, :y 62.783079384466475, :z 77.8204764703242},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 55.09425318302945, :y 62.783079384466475, :z 77.8204764703242},
   :end
   {:x 64.30654390548769, :y 60.342621609523036, :z 79.70335487081317},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 64.30654390548769, :y 60.342621609523036, :z 79.70335487081317},
   :end
   {:x 82.88326207911811, :y 66.99419536603975, :z 80.39866581590539},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 82.88326207911811, :y 66.99419536603975, :z 80.39866581590539},
   :end
   {:x 74.59652545646236, :y 74.14922520144111, :z 72.858596909442},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 74.59652545646236, :y 74.14922520144111, :z 72.858596909442},
   :end
   {:x 82.93865747537787, :y 85.3112013012377, :z 84.53036909971942},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 82.93865747537787, :y 85.3112013012377, :z 84.53036909971942},
   :end
   {:x 68.97002761284463, :y 84.48103784668342, :z 89.74274960205952},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 68.97002761284463, :y 84.48103784668342, :z 89.74274960205952},
   :end
   {:x 93.07227141810941, :y 78.06224488023342, :z 97.20786226283406},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 93.07227141810941, :y 78.06224488023342, :z 97.20786226283406},
   :end
   {:x 88.63222264320842, :y 73.83614260075052, :z 101.59724185255578},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 88.63222264320842, :y 73.83614260075052, :z 101.59724185255578},
   :end
   {:x 94.40689723112216, :y 90.82580541816904, :z 75.18280129150264},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 94.40689723112216, :y 90.82580541816904, :z 75.18280129150264},
   :end
   {:x 98.07749604086369, :y 107.92241622316112, :z 83.79681914106735},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 98.07749604086369, :y 107.92241622316112, :z 83.79681914106735},
   :end
   {:x 87.02112501739992, :y 105.26242122480774, :z 93.24615430973105},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 87.02112501739992, :y 105.26242122480774, :z 93.24615430973105},
   :end
   {:x 97.44915491717418, :y 85.65717882674878, :z 107.39846274773637},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 97.44915491717418, :y 85.65717882674878, :z 107.39846274773637},
   :end
   {:x 102.32530034989715, :y 90.80337434612716, :z 93.34498689018413},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 102.32530034989715, :y 90.80337434612716, :z 93.34498689018413},
   :end
   {:x 112.25388818023274,
    :y 111.49846064558933,
    :z 113.48113862140232},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 112.25388818023274,
    :y 111.49846064558933,
    :z 113.48113862140232},
   :end
   {:x 118.07534991880758,
    :y 120.8708740938488,
    :z 122.69569557730856},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 118.07534991880758,
    :y 120.8708740938488,
    :z 122.69569557730856},
   :end
   {:x 110.93772736549374,
    :y 115.26558672428341,
    :z 116.0472912507458},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 110.93772736549374,
    :y 115.26558672428341,
    :z 116.0472912507458},
   :end
   {:x 103.14812843049751,
    :y 108.55914340441439,
    :z 128.2096825947399},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 103.14812843049751,
    :y 108.55914340441439,
    :z 128.2096825947399},
   :end
   {:x 107.48259645966338,
    :y 131.75613435612829,
    :z 119.64420751039636},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 107.48259645966338,
    :y 131.75613435612829,
    :z 119.64420751039636},
   :end
   {:x 125.53855517385638,
    :y 110.47477395898986,
    :z 134.6392241834239},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 125.53855517385638,
    :y 110.47477395898986,
    :z 134.6392241834239},
   :end
   {:x 126.07770126750985,
    :y 116.60171733232332,
    :z 133.6508359929162},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 126.07770126750985,
    :y 116.60171733232332,
    :z 133.6508359929162},
   :end
   {:x 117.1627810902096,
    :y 138.22308711640216,
    :z 122.42044843819689},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 117.1627810902096,
    :y 138.22308711640216,
    :z 122.42044843819689},
   :end
   {:x 115.0065693934105,
    :y 116.29274468940017,
    :z 140.91755173105486},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 115.0065693934105,
    :y 116.29274468940017,
    :z 140.91755173105486},
   :end
   {:x 120.88325292939282,
    :y 127.92792489485373,
    :z 128.24990147010192},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 120.88325292939282,
    :y 127.92792489485373,
    :z 128.24990147010192},
   :end
   {:x 137.5475044829821,
    :y 123.13854276626084,
    :z 123.31467810401968},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 137.5475044829821,
    :y 123.13854276626084,
    :z 123.31467810401968},
   :end
   {:x 131.12864587390112,
    :y 145.06748251078108,
    :z 144.70562777730447},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 131.12864587390112,
    :y 145.06748251078108,
    :z 144.70562777730447},
   :end
   {:x 136.2269770212828,
    :y 155.46393776541228,
    :z 127.13147065680675},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 136.2269770212828,
    :y 155.46393776541228,
    :z 127.13147065680675},
   :end
   {:x 153.17978226296825,
    :y 139.8401346629329,
    :z 144.87612507480858},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 153.17978226296825,
    :y 139.8401346629329,
    :z 144.87612507480858},
   :end
   {:x 145.97327791329226,
    :y 150.28337007367958,
    :z 133.80368093329582},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 145.97327791329226,
    :y 150.28337007367958,
    :z 133.80368093329582},
   :end
   {:x 138.5179741633741, :y 144.08883233313932, :z 157.5268535033559},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 138.5179741633741, :y 144.08883233313932, :z 157.5268535033559},
   :end
   {:x 166.63289404293164,
    :y 152.31796426979858,
    :z 164.39430469884934},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 166.63289404293164,
    :y 152.31796426979858,
    :z 164.39430469884934},
   :end
   {:x 144.78262586397273,
    :y 152.85023310950356,
    :z 148.43952404392826},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 144.78262586397273,
    :y 152.85023310950356,
    :z 148.43952404392826},
   :end
   {:x 165.95351524851563,
    :y 170.1686830782039,
    :z 166.14087905098364},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 165.95351524851563,
    :y 170.1686830782039,
    :z 166.14087905098364},
   :end
   {:x 165.52690023650345, :y 155.565512283654, :z 155.6348912480909},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 165.52690023650345, :y 155.565512283654, :z 155.6348912480909},
   :end
   {:x 164.82253044539132,
    :y 157.69513869574698,
    :z 157.22501486903576},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 164.82253044539132,
    :y 157.69513869574698,
    :z 157.22501486903576},
   :end
   {:x 176.2690688294117, :y 168.2411714580007, :z 158.23438648991845},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 176.2690688294117, :y 168.2411714580007, :z 158.23438648991845},
   :end
   {:x 183.20072266794585,
    :y 178.08158974377469,
    :z 160.59428218673074},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 183.20072266794585,
    :y 178.08158974377469,
    :z 160.59428218673074},
   :end
   {:x 162.9207258831389, :y 163.6731007794561, :z 171.37020446315566},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 162.9207258831389, :y 163.6731007794561, :z 171.37020446315566},
   :end
   {:x 187.7972353994794, :y 175.4287514524014, :z 190.2417297582051},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 187.7972353994794, :y 175.4287514524014, :z 190.2417297582051},
   :end
   {:x 191.94230217974973, :y 185.844435228654, :z 173.56253989175988},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 191.94230217974973, :y 185.844435228654, :z 173.56253989175988},
   :end
   {:x 172.43976210595022, :y 170.43857696454143, :z 180.322031025474},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 172.43976210595022, :y 170.43857696454143, :z 180.322031025474},
   :end
   {:x 200.2595866165381, :y 171.13257417457754, :z 192.0589468963521},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 200.2595866165381, :y 171.13257417457754, :z 192.0589468963521},
   :end
   {:x 185.22706229097082, :y 190.76522452825, :z 191.10300967103527},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 185.22706229097082, :y 190.76522452825, :z 191.10300967103527},
   :end
   {:x 178.14960555675896,
    :y 186.35334673490615,
    :z 177.07978559189397},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 178.14960555675896,
    :y 186.35334673490615,
    :z 177.07978559189397},
   :end
   {:x 184.12267056781923,
    :y 197.37722153054966,
    :z 185.2531039619846},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 184.12267056781923,
    :y 197.37722153054966,
    :z 185.2531039619846},
   :end
   {:x 201.15347856274786,
    :y 198.0917764456204,
    :z 191.27426508846224},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 201.15347856274786,
    :y 198.0917764456204,
    :z 191.27426508846224},
   :end
   {:x 213.81833464715274,
    :y 202.3911336563972,
    :z 205.81716898851064},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 213.81833464715274,
    :y 202.3911336563972,
    :z 205.81716898851064},
   :end
   {:x 208.01243297634494,
    :y 201.3568645551396,
    :z 215.53557057398243},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 208.01243297634494,
    :y 201.3568645551396,
    :z 215.53557057398243},
   :end
   {:x 197.58677792866214,
    :y 207.6789483069801,
    :z 212.10493932198926},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 197.58677792866214,
    :y 207.6789483069801,
    :z 212.10493932198926},
   :end
   {:x 223.16603657647198,
    :y 217.81102360995084,
    :z 223.51434247281128},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 223.16603657647198,
    :y 217.81102360995084,
    :z 223.51434247281128},
   :end
   {:x 227.42406758519357,
    :y 220.38320303327134,
    :z 201.60476859294067},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 227.42406758519357,
    :y 220.38320303327134,
    :z 201.60476859294067},
   :end
   {:x 230.5369667343939, :y 224.20896187128156, :z 221.9832497621629},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 230.5369667343939, :y 224.20896187128156, :z 221.9832497621629},
   :end
   {:x 210.8594250097435,
    :y 226.19441965211143,
    :z 228.21878711262536},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 210.8594250097435,
    :y 226.19441965211143,
    :z 228.21878711262536},
   :end
   {:x 219.39633964724362,
    :y 233.17100768606548,
    :z 210.3716866830262},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 219.39633964724362,
    :y 233.17100768606548,
    :z 210.3716866830262},
   :end
   {:x 234.06577842363362,
    :y 216.21125541308191,
    :z 233.35603992407832},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 234.06577842363362,
    :y 216.21125541308191,
    :z 233.35603992407832},
   :end
   {:x 224.1967925661209,
    :y 242.77248140016133,
    :z 242.28894671649172},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 224.1967925661209,
    :y 242.77248140016133,
    :z 242.28894671649172},
   :end
   {:x 223.81742209008019,
    :y 239.94359838155577,
    :z 235.06361893914726},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 223.81742209008019,
    :y 239.94359838155577,
    :z 235.06361893914726},
   :end
   {:x 241.6244716153988, :y 224.8218635299205, :z 227.46621969186356},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 241.6244716153988, :y 224.8218635299205, :z 227.46621969186356},
   :end
   {:x 244.15892305346944,
    :y 231.1240531804989,
    :z 224.94345852788422},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 244.15892305346944,
    :y 231.1240531804989,
    :z 224.94345852788422},
   :end
   {:x 238.06489690423828,
    :y 254.14182752616796,
    :z 253.22789400007656},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 238.06489690423828,
    :y 254.14182752616796,
    :z 253.22789400007656},
   :end
   {:x 230.3328220436818,
    :y 237.66474662758947,
    :z 228.82380981186276},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 230.3328220436818,
    :y 237.66474662758947,
    :z 228.82380981186276},
   :end
   {:x 245.85166597138397,
    :y 240.94137689851115,
    :z 254.25629094389683},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 245.85166597138397,
    :y 240.94137689851115,
    :z 254.25629094389683},
   :end
   {:x 254.9378366730835, :y 234.6347804178969, :z 251.82127129123919},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 254.9378366730835, :y 234.6347804178969, :z 251.82127129123919},
   :end
   {:x 262.336758502641, :y 252.7573029347303, :z 253.89990230429706},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 262.336758502641, :y 252.7573029347303, :z 253.89990230429706},
   :end
   {:x 247.6409357632537, :y 244.6605805024513, :z 241.06614220308205},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 247.6409357632537, :y 244.6605805024513, :z 241.06614220308205},
   :end
   {:x 267.7292531500953, :y 261.2761482671558, :z 265.67557331451405},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 267.7292531500953, :y 261.2761482671558, :z 265.67557331451405},
   :end
   {:x 275.0888580045473, :y 249.36079237099295, :z 253.0207188008202},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 275.0888580045473, :y 249.36079237099295, :z 253.0207188008202},
   :end
   {:x 267.8706696536566, :y 261.5955994090089, :z 258.48679049802416},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 267.8706696536566, :y 261.5955994090089, :z 258.48679049802416},
   :end
   {:x 266.01198763214194, :y 259.5026814961181, :z 276.5941332491757},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 266.01198763214194, :y 259.5026814961181, :z 276.5941332491757},
   :end
   {:x 274.91936933293675,
    :y 267.69081244575375,
    :z 279.0999395739627},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 274.91936933293675,
    :y 267.69081244575375,
    :z 279.0999395739627},
   :end
   {:x 286.98167878497736, :y 260.1234804300967, :z 263.1920576211485},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 286.98167878497736, :y 260.1234804300967, :z 263.1920576211485},
   :end
   {:x 262.73154820755633, :y 289.1214977244062, :z 272.6708907050722},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 262.73154820755633, :y 289.1214977244062, :z 272.6708907050722},
   :end
   {:x 283.8879762594156, :y 293.46268214624115, :z 271.2977239096941},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 283.8879762594156, :y 293.46268214624115, :z 271.2977239096941},
   :end
   {:x 271.64495087106013,
    :y 268.49829827899464,
    :z 267.48442862817353},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 271.64495087106013,
    :y 268.49829827899464,
    :z 267.48442862817353},
   :end
   {:x 279.85014157305716,
    :y 271.3471427417093,
    :z 295.80243844552257},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 279.85014157305716,
    :y 271.3471427417093,
    :z 295.80243844552257},
   :end
   {:x 278.25970560664183, :y 282.6902138437498, :z 279.5773516740453},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 278.25970560664183, :y 282.6902138437498, :z 279.5773516740453},
   :end
   {:x 284.5201814722347,
    :y 296.19465626977103,
    :z 303.26250089968124},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 284.5201814722347,
    :y 296.19465626977103,
    :z 303.26250089968124},
   :end
   {:x 284.12596071316017,
    :y 295.7269929005836,
    :z 300.82194056564504},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 284.12596071316017,
    :y 295.7269929005836,
    :z 300.82194056564504},
   :end
   {:x 299.07882684039686,
    :y 296.3385503965036,
    :z 292.19266296658316},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 299.07882684039686,
    :y 296.3385503965036,
    :z 292.19266296658316},
   :end
   {:x 296.36601244039275,
    :y 305.4780544762419,
    :z 288.73609015830414},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 296.36601244039275,
    :y 305.4780544762419,
    :z 288.73609015830414},
   :end
   {:x 310.7036449499423, :y 314.5265390729844, :z 306.2083763609},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 310.7036449499423, :y 314.5265390729844, :z 306.2083763609},
   :end
   {:x 308.11818000905464, :y 311.878586780567, :z 294.81553416512844},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 308.11818000905464, :y 311.878586780567, :z 294.81553416512844},
   :end
   {:x 321.0723466148493, :y 310.91199863335135, :z 298.1389026028386},
   :color "purple"}]
 [:cylinder
  {:start
   {:x 321.0723466148493, :y 310.91199863335135, :z 298.1389026028386},
   :end
   {:x 314.3123500277778, :y 326.5905522106664, :z 309.8144491272908},
   :color "purple"}]]

Showing the cylinders

(-> points
    (dataset->cylinders {:color "purple"
                         :radius 2})
    (->> (shapes-view {:height 200
                       :width 200})))